package kr.saeildamil.androidforstudy2.ch22;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;

public class Ch22Main extends Activity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		LinearLayout layout = new LinearLayout(this);
		layout.setOrientation(LinearLayout.VERTICAL);
		
		LinearLayout.LayoutParams params = new LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
		
		Button btn01 = new Button(this);
		btn01.setText("BlurFilter");
		btn01.setId(0);
		btn01.setOnClickListener(listener);
		
		Button btn02 = new Button(this);
		btn02.setText("BlurFilter02");
		btn02.setId(1);
		btn02.setOnClickListener(listener);
		
		Button btn03 = new Button(this);
		btn03.setText("BallReflection");
		btn03.setId(2);
		btn03.setOnClickListener(listener);
		
		Button btn04 = new Button(this);
		btn04.setText("BallReflection(SurfaceView)");
		btn04.setId(3);
		btn04.setOnClickListener(listener);
		
		Button btn05 = new Button(this);
		btn05.setText("OpenGLTest");
		btn05.setId(4);
		btn05.setOnClickListener(listener);
		
		layout.addView(btn01, params);
		layout.addView(btn02, params);
		layout.addView(btn03, params);
		layout.addView(btn04, params);
		layout.addView(btn05, params);
		
		setContentView(layout);
		// setContentView(R.layout.ch22_main);
	}

		OnClickListener listener = new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent();
				switch (v.getId()) {
				case 0:
					intent.setClass(Ch22Main.this, BlurFilter.class);
					break;
				case 1:
					intent.setClass(Ch22Main.this, BlurFilter2.class);
					break;
				case 2:
					intent.setClass(Ch22Main.this, Reflection.class);
					break;
				case 3:
					intent.setClass(Ch22Main.this, Reflection02.class);
					break;
				case 4:
					intent.setClass(Ch22Main.this, OpenGLTest.class);
					break;
				}
				startActivity(intent);
			}
		};
}
	/*	public void mOnClick(View v){
			Intent intent = new Intent();
			switch (v.getId()) {
			case R.id.ch22_btn01:
				intent.setClass(this, BlurFilter.class);
				break;
			case R.id.ch22_btn02:
				intent.setClass(this, BlurFilter2.class);
				break;
			}
			startActivity(intent);
		}*/

	
